package com.shenmazong.review.controller;

import com.shenmazong.review.service.TbAskPaperDetailService;
import com.shenmazong.review.service.TbAskPaperService;
import com.shenmazong.review.service.TbUserReviewReportService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.IdVo;
import com.shenmazong.vo.ReplyQuestionVo;
import com.shenmazong.vo.ReviewInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2022/4/7 8:55
 */

@RestController
@Slf4j
@CrossOrigin
@RequestMapping(value = "/review")
public class ReviewController {

    @Autowired
    TbAskPaperService tbAskPaperService;

    @Autowired
    TbAskPaperDetailService tbAskPaperDetailService;

    @Autowired
    TbUserReviewReportService tbUserReviewReportService;

    /**
     * @description 获取评测问卷列表
     * @author 军哥
     * @date 2022/4/7 8:59
     * @version 1.0
     */
    @PostMapping(value = "/getReviewPaperList")
    public ResultResponse getReviewPaperList() {
        return tbAskPaperService.getReviewPaperList();
    }

    /**
     * @description 开始评测：把评测问题的ID放入redis的list中
     * @author 军哥
     * @date 2022/4/7 9:03
     * @version 1.0
     */
    @PostMapping(value = "/beginReviewByPaperId")
    public ResultResponse beginReviewByPaperId(@RequestBody ReviewInfoVo infoVo) {
        return tbAskPaperService.beginReviewByPaperId(infoVo);
    }

    /**
     * @description 获取评测的问题，当没有问题，则评测结束
     * @author 军哥
     * @date 2022/4/7 9:06
     * @version 1.0
     */
    @PostMapping(value = "/getReviewQuestion")
    public ResultResponse getReviewQuestion(@RequestBody IdVo idVo) {
        return tbAskPaperDetailService.getReviewQuestion(idVo);
    }

    /**
     * @description 获取评测的问题，当没有问题，则评测结束
     * @author 军哥
     * @date 2022/4/7 9:06
     * @version 1.0
     */
    @PostMapping(value = "/replyReviewQuestion")
    public ResultResponse replyReviewQuestion(@RequestBody ReplyQuestionVo replyQuestionVo) {
        return tbAskPaperDetailService.replyReviewQuestion(replyQuestionVo);
    }

    /**
     * @description 生成报告
     * @author 军哥
     * @date 2022/4/7 9:09
     * @version 1.0
     */
    @PostMapping(value = "/doMakeReviewReport")
    public ResultResponse doMakeReviewReport(@RequestBody IdVo idVo) {
        return tbUserReviewReportService.doMakeReviewReport(idVo);
    }

    /**
     * @description 获取用户评测报告列表
     * @author 军哥
     * @date 2022/4/7 9:12
     * @version 1.0
     */
    @PostMapping(value = "/getUserReviewReportList")
    public ResultResponse getUserReviewReportList(@RequestBody IdVo idVo) {
        return tbUserReviewReportService.getUserReviewReportList(idVo);
    }

    /**
     * @description 获取报告的详细信息
     * @author 军哥
     * @date 2022/4/7 9:12
     * @version 1.0
     */
    @PostMapping(value = "/getUserReviewReport")
    public ResultResponse getUserReviewReport(@RequestBody IdVo idVo) {
        return tbUserReviewReportService.getUserReviewReport(idVo);
    }
}
